//
//  SegementedControl.m
//  SegementDemo
//
//  Created by wh15113030 on 16/7/18.
//  Copyright © 2016年 wh15113030. All rights reserved.
//

#import "SegementedControl.h"

@implementation SegementedControl

- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
              
        self.multipleTouchEnabled = YES;
        self.momentary = NO; //设置在点击后是否恢复原样
        self.tintColor = [UIColor blackColor];
        self.backgroundColor = UIColorFromRGB(0xfee77a);
        
        NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:[UIColor blackColor],NSForegroundColorAttributeName,[UIFont systemFontOfSize:12],NSFontAttributeName ,nil];
        [self setTitleTextAttributes:dic forState:UIControlStateNormal];
        
        
        NSDictionary *dic1 = [NSDictionary dictionaryWithObjectsAndKeys:[UIColor colorWithRed:0.980 green:0.890 blue:0.400 alpha:1.000],NSForegroundColorAttributeName,[UIFont systemFontOfSize:12],NSFontAttributeName ,nil];
        
        [self setTitleTextAttributes:dic1 forState:UIControlStateSelected];

    }
    return self;
}





- (void)layoutSubviews{
    [super layoutSubviews];
    
    for (UIView *subview in self.subviews) {
        
        subview.layer.cornerRadius = 10;
        subview.clipsToBounds = YES;
        
        
           NSLog(@"%@-------%s",[subview class],__func__);
            
    }

    
    
}

@end
